package com.xinxin.intelligenceexam.domain;

/**
 * User: Tianxin
 * Date: 2016-11-21
 * Time: 21:01
 */

public class Reply {
    private Question mQuestion;
    private int answer;

    public Reply(int answer,Question question) {
        this.answer = answer;
        mQuestion = question;
    }

    public Reply() {
    }

    public int getQuestionId() {
        return mQuestion.getId();
    }


    public Question getQuestion() {
        return mQuestion;
    }

    public void setQuestion(Question question) {
        mQuestion = question;
    }

    public int getAnswer() {
        return answer;
    }

    public void setAnswer(int answer) {
        this.answer = answer;
    }

    public boolean isRight() {
        return checkAnswer();
    }

    private boolean checkAnswer(){
        return ((char) ('A' - 1 + answer) + "").equalsIgnoreCase(mQuestion.getAnswer());
    }
}
